


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
  <meta charset="utf-8">
  <meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>hfai.client.remote &mdash; HAI Platform  documentation</title>
  

  <link rel="shortcut icon" href="../_static/images/logo192.png" />
  
  

  

  
  
  

  

  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <!-- <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> -->
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/custom.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/element-plus.css" type="text/css" />
  <link rel="index" title="Index" href="../genindex.html" />
  <link rel="search" title="Search" href="../search.html" />
  <link rel="next" title="环境变量" href="../misc/env_var.html" />
  <link rel="prev" title="hfai.client" href="client.html" />
  <!-- Google Analytics -->
  <script type="text/javascript">
    var collapsedSections = [];
  </script>
  
  <!-- End Google Analytics -->
  

  
  <script src="../_static/js/modernizr.min.js"></script>
  <script>
    MathJax = {
        chtml: {
            scale: 1,
            minScale: 1,
        },
        svg: {
            scale: 1,
            minScale: 1,
        }
    }
</script>

  <!-- Preload the theme fonts -->

<link rel="preload" href="../_static/fonts/FreightSans/freight-sans-book.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/fonts/FreightSans/freight-sans-medium.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/fonts/IBMPlexMono/IBMPlexMono-Medium.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/fonts/FreightSans/freight-sans-bold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/fonts/FreightSans/freight-sans-medium-italic.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff2" as="font" type="font/woff2" crossorigin="anonymous">

<!-- Preload the katex fonts -->

<link rel="preload" href="../_static/external/KaTeX_Math-Italic.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Main-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Main-Bold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Size1-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Size4-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Size2-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Size3-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="../_static/external/KaTeX_Caligraphic-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
  <link rel="stylesheet" href="../_static/external/all.css"
    integrity="sha384-vSIIfh2YWi9wW0r9iZe7RJPrKwp6bG+s9QZMoITbCckVJqGCCRhc+ccxNcdpHuYu" crossorigin="anonymous">
</head>

<div class="container-fluid header-holder tutorials-header" id="header-holder">
  <div class="container">
    <div class="header-container">
      <a class="header-logo" href=""
        aria-label="OpenMMLab"></a>

      <div class="main-menu">
        <ul>
        </ul>
      </div>

      <!-- <a class="main-menu-open-button" href="#" data-behavior="open-mobile-menu"></a> -->
    </div>
  </div>
</div>

<body class="pytorch-body">

   

  

  <div class="table-of-contents-link-wrapper">
    <span>Table of Contents</span>
    <a href="#" class="toggle-table-of-contents" data-behavior="toggle-table-of-contents"></a>
  </div>

  <nav data-toggle="wy-nav-shift" class="pytorch-left-menu" id="pytorch-left-menu">
    <div class="pytorch-side-scroll">
      <div class="pytorch-menu pytorch-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
        <div class="pytorch-left-menu-search">
          

          
          
          
          

          



<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search Docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        
        
        
        
        
        <p class="caption" role="heading"><span class="caption-text">开始使用</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../start/hai_intro.html">基本介绍</a></li>
<li class="toctree-l1"><a class="reference internal" href="../start/install.html">安装与设置</a></li>
<li class="toctree-l1"><a class="reference internal" href="../start/studio.html">Studio</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">用户须知</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../guide/tutorial.html">命令行工具 (CLI)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../guide/environment.html">环境配置</a></li>
<li class="toctree-l1"><a class="reference internal" href="../guide/schedule.html">分时调度</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">CLI 说明</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../cli/user.html">用户命令</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cli/exec.html">运行命令</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cli/task.html">任务命令</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cli/cluster.html">集群命令</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cli/ugc.html">UGC 命令</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">API 说明</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="hai.html">hfai</a></li>
<li class="toctree-l1"><a class="reference internal" href="client.html">hfai.client</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">hfai.client.remote</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">其他</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../misc/env_var.html">环境变量</a></li>
<li class="toctree-l1"><a class="reference internal" href="../misc/resources.html">外部资源</a></li>
</ul>

        
        
      </div>
    </div>
  </nav>

  <div class="pytorch-container">
    <div class="pytorch-page-level-bar" id="pytorch-page-level-bar">
      <div class="pytorch-breadcrumbs-wrapper">
        















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="pytorch-breadcrumbs">
    
      <li>
        <a href="../index.html">
            Docs
        </a> &gt;
      </li>

        
      <li>hfai.client.remote</li>
    
    
      <li class="pytorch-breadcrumbs-aside">
        
            
            <a href="../_sources/api/client_remote.rst.txt" rel="nofollow"><img src="../_static/images/view-page-source-icon.svg"></a>
          
        
      </li>
    
  </ul>

  
</div>
      </div>

      <div class="pytorch-shortcuts-wrapper" id="pytorch-shortcuts-wrapper">
        Shortcuts
      </div>
    </div>

    <section data-toggle="wy-nav-shift" id="pytorch-content-wrap" class="pytorch-content-wrap">
      <div class="pytorch-content-left">
        
          <div class="rst-content">
            
            <div role="main" class="main-content" itemscope="itemscope" itemtype="http://schema.org/Article">
              <article itemprop="articleBody" id="pytorch-article" class="pytorch-article">
                
  <section id="hfai-client-remote">
<h1>hfai.client.remote<a class="headerlink" href="#hfai-client-remote" title="Permalink to this headline">¶</a></h1>
<div class="toctree-wrapper compound">
</div>
<table class="autosummary longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hfai.client.remote.GlobalSession" title="hfai.client.remote.GlobalSession"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GlobalSession</span></code></a></p></td>
<td><p>远程运行的Session</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hfai.client.remote.SessionConfig" title="hfai.client.remote.SessionConfig"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SessionConfig</span></code></a></p></td>
<td><p>配置Session，本地还是远程，远程用哪个分组</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">hfai.client.remote.</span></span><span class="sig-name descname"><span class="pre">GlobalSession</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">main_globals</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modules</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">session_config</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession" title="Permalink to this definition">¶</a></dt>
<dd><p>远程运行的Session</p>
<p>在主进程构造一个 session，用于管理用户开发的 modules，并且，比如设置 modules 中的 global values
逻辑上和 multiprocess.pool 有点接近，可以以此类别，帮助理解
详细配置见 SessionConfig</p>
<p>Examples:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># demo.py</span>
<span class="n">foo</span> <span class="o">=</span> <span class="s1">&#39;bar&#39;</span>
<span class="k">def</span> <span class="nf">func1</span><span class="p">(</span><span class="n">param1</span><span class="p">,</span> <span class="n">param2</span><span class="p">):</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="n">param1</span><span class="p">,</span> <span class="n">param2</span><span class="p">)</span>
    <span class="k">return</span> <span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="n">foo</span><span class="si">}</span><span class="s1">_</span><span class="si">{</span><span class="n">param1</span><span class="si">}</span><span class="s1">_</span><span class="si">{</span><span class="n">param2</span><span class="si">}</span><span class="s1">&#39;</span>
</pre></div>
</div>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># main.ipynb</span>
<span class="c1"># 构造 session 来运行</span>
<span class="kn">import</span> <span class="nn">demo</span> <span class="k">as</span> <span class="nn">demo2</span>
<span class="n">session</span> <span class="o">=</span> <span class="n">GlobalSession</span><span class="p">(</span><span class="nb">globals</span><span class="p">(),</span> <span class="p">(</span><span class="n">demo2</span><span class="p">,</span> <span class="p">),</span> <span class="n">session_config</span><span class="o">=</span><span class="n">SessionConfig</span><span class="p">())</span>
<span class="k">with</span> <span class="n">session</span><span class="o">.</span><span class="n">modules_globals</span><span class="p">():</span>
    <span class="n">foo</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">session</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">demo2</span><span class="o">.</span><span class="n">func1</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="p">),</span> <span class="p">{</span><span class="s1">&#39;param2&#39;</span><span class="p">:</span> <span class="s1">&#39;b&#39;</span><span class="p">})</span> <span class="c1"># 使用 foo = 1 且 demo 修改了会 自动 reload</span>
<span class="n">session</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">demo2</span><span class="o">.</span><span class="n">func1</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="p">),</span> <span class="p">{</span><span class="s1">&#39;param2&#39;</span><span class="p">:</span> <span class="s1">&#39;b&#39;</span><span class="p">},</span> <span class="n">local</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="c1"># 远程运行</span>

<span class="c1"># 在 local + inline 运行模式中，等价与：</span>
<span class="n">importlib</span><span class="o">.</span><span class="n">reload</span><span class="p">(</span><span class="n">demo2</span><span class="p">)</span>
<span class="n">session</span><span class="o">.</span><span class="n">update_values</span><span class="p">(</span><span class="n">demo2</span><span class="p">)</span>
<span class="n">demo2</span><span class="o">.</span><span class="n">func1</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="s1">&#39;b&#39;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.apply">
<span class="sig-name descname"><span class="pre">apply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kwargs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">blocking</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">renew_global_var</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">packaging_func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">priority</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.apply"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.apply" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>运行注册了的 module 中的 func 函数，运行 <cite>module.func(*args, **kwargs)</cite></p>
<p>根据配置有以下三种核心模式(直接模式)与 packaging 特殊模式(建议使用 package 接口)：</p>
<ol class="arabic simple">
<li><p>local = True and inline = True:</p></li>
</ol>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># 相当于下面的代码</span>
<span class="n">importlib</span><span class="o">.</span><span class="n">reload</span><span class="p">(</span><span class="n">module</span><span class="p">)</span>
<span class="n">session</span><span class="o">.</span><span class="n">update_values</span><span class="p">(</span><span class="n">module</span><span class="p">)</span>
<span class="n">pool</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">module</span><span class="o">.</span><span class="n">func</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span>
</pre></div>
</div>
<ol class="arabic simple" start="2">
<li><p>local = True and inline = False</p></li>
</ol>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># 注意，会带来 pkl 的开销，建议在使用 remote 之前 inline False 跑一跑</span>
<span class="c1"># 一般而言，这个模式能跑的，remote 模式也能跑</span>
<span class="c1"># inline = False 可以通过，async_result.stdout() 来打印输出</span>
<span class="n">python</span> <span class="n">remote_call</span><span class="o">.</span><span class="n">py</span> <span class="o">--</span><span class="n">module</span> <span class="n">module</span><span class="o">.</span><span class="n">py</span> <span class="o">--</span><span class="n">func</span> <span class="n">function</span>
</pre></div>
</div>
<ol class="arabic simple" start="3">
<li><p>local = False and inline = False:</p></li>
</ol>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># 提交任务远程运行</span>
<span class="n">hfai</span> <span class="n">python</span> <span class="n">remote_call</span><span class="o">.</span><span class="n">py</span> <span class="o">--</span><span class="n">module</span> <span class="n">module</span><span class="o">.</span><span class="n">py</span> <span class="o">--</span><span class="n">func</span> <span class="n">function</span> <span class="o">--</span> <span class="o">--</span><span class="n">nodes</span> <span class="mi">1</span>
</pre></div>
</div>
<ol class="arabic simple" start="4">
<li><p>packaging 模式： packaging_options:</p></li>
</ol>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># 把多进程任务打包到一个任务上运行</span>
<span class="c1"># pool.map(func, iterable=args)</span>
<span class="c1"># pool.starmap(func, iterable=args)</span>
</pre></div>
</div>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> – 模块中的函数，输入中需要带上 <cite>module.</cite>，如 <cite>demo.func1</cite> 这样</p></li>
<li><p><strong>args</strong> – func 的 args 参数</p></li>
<li><p><strong>kwargs</strong> – func 的 kwargs 参数</p></li>
<li><p><strong>local</strong> – 本地运行；不指定的话，会使用 session 构造中传入的 session_config</p></li>
<li><p><strong>inline</strong> – local 下的 inline 模式, 不建议使用；不指定的话，会使用 session 构造中传入的 session_config</p></li>
<li><p><strong>group</strong> – 远程运行到哪个分组的机器上</p></li>
<li><p><strong>blocking</strong> – True 同步接口，False 异步接口，返回 AsyncResult</p></li>
<li><p><strong>stdout</strong> – 是否在 outline 任务打印 stdout，apply 接口先不要用</p></li>
<li><p><strong>renew_global_var</strong> – 在调用函数的时候，自动更新 global var</p></li>
<li><p><strong>packaging_func</strong> – None, 表示不起用 outline 时候使用，此时，args 是一个 iterable，会启动一个 pool 来运行 func 把多个任务打包提交上去跑</p></li>
<li><p><strong>priority</strong> – 设置远程提交任务的优先级，不填则使用 Session Config 中的设置</p></li>
<li><p><strong>image</strong> – 使用哪个镜像运行，不填则用 Session Config 中的设置</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>blocking: <cite>func(*args, **kwargs)</cite> 的结果；not blocking，返回 AsyncResult</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.apply_async">
<span class="sig-name descname"><span class="pre">apply_async</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kwargs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">renew_global_var</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">priority</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.apply_async"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.apply_async" title="Permalink to this definition">¶</a></dt>
<dd><p>一个异步的接口，返回一个 AsyncResult;</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.load_global_vars">
<span class="sig-name descname"><span class="pre">load_global_vars</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">saved_global_values_path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.load_global_vars"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.load_global_vars" title="Permalink to this definition">¶</a></dt>
<dd><p>从指定路径中加载上次保存的 global var</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>saved_global_values_path</strong> – </p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.map">
<span class="sig-name descname"><span class="pre">map</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">blocking</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">star</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">priority</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.map"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.map" title="Permalink to this definition">¶</a></dt>
<dd><p>多进程迭代运行，并且返回输出 list, 类比 pool.map, pool.starmap</p>
<dl class="simple">
<dt>注意事项:</dt><dd><ol class="arabic simple">
<li><p>远程运行如果没有资源会一个个排队</p></li>
<li><p>args_list 和 kwargs_list 不能同时存在</p></li>
</ol>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> – 需要引用的函数</p></li>
<li><p><strong>iterable</strong> – [(1, 2), (3, 4)] -&gt; start = True: func(1, 2), func(3, 4); star = False: func((1, 2), ), func((3, 4), )</p></li>
<li><p><strong>local</strong> – 本地运行</p></li>
<li><p><strong>inline</strong> – </p></li>
<li><p><strong>group</strong> – 远程运行到哪个分组的机器上</p></li>
<li><p><strong>blocking</strong> – 是否放后台运行</p></li>
<li><p><strong>stdout</strong> – 要不要 stdout 输出内容，默认 False 防止 map 太多打爆；outline 会把 stdout pkl 下来方便日后查看</p></li>
<li><p><strong>star</strong> – True 的时候相当于 pool 的 starmap</p></li>
<li><p><strong>priority</strong> – 设置优先级，不设置则为 session config 中的</p></li>
<li><p><strong>image</strong> – 设置运行的镜像，不设置则为 session config 中的</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>blocking True 返回对应的输出；False 返回List[AsyncResult]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.map_async">
<span class="sig-name descname"><span class="pre">map_async</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.map_async"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.map_async" title="Permalink to this definition">¶</a></dt>
<dd><p>map 的异步调用</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List[Async_result]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.modules_globals">
<span class="sig-name descname"><span class="pre">modules_globals</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.modules_globals"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.modules_globals" title="Permalink to this definition">¶</a></dt>
<dd><p>记录，并且更新 modules 中的 global_var(若有)</p>
<p>注意：</p>
<ol class="arabic">
<li><dl>
<dt>对于 [引用] 的变量，在 modules_globals 记录之后，可以直接赋值，会进行更新</dt><dd><div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">session</span><span class="o">.</span><span class="n">modules_globals</span><span class="p">():</span>
    <span class="n">a</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">a</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>    <span class="c1"># module.a -&gt; [1]</span>
<span class="n">a</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>  <span class="c1"># module.a -&gt; [2, 3, 4]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>对于 [赋值] 的变量，如 int、str，在 modules_globals 记录之后，直接赋值不会进行更新，</dt><dd><p>2.1 在同一个notebook cell中需要 reload 或者 with 重新更新；</p>
<p>2.2 不同 cell 之间，我们注册了 auto reload 机制，会在 cell 运行之前设置变量、更新代码</p>
<p>2.3 建议在赋值完成之后，启动一个新的 cell 运行，这样也比较清晰</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># session = GlobalSession(auto_reload_interval=2) # 构造的时候输入也可以</span>
<span class="c1"># session.auto_reload(2)  # 显示调用，一般不用，在构造的时候可以传入，让他进行自动 reload</span>

<span class="k">with</span> <span class="n">session</span><span class="o">.</span><span class="n">modules_globals</span><span class="p">():</span>
    <span class="n">a</span> <span class="o">=</span> <span class="mi">1</span>
<span class="c1"># 同一个 cell</span>
<span class="n">a</span> <span class="o">=</span> <span class="mi">2</span>
<span class="nb">print</span><span class="p">(</span><span class="n">module</span><span class="o">.</span><span class="n">a</span><span class="p">)</span> <span class="c1"># -&gt; 1, 赋值的不会变;</span>
<span class="n">session</span><span class="o">.</span><span class="n">reload</span><span class="p">()</span> <span class="c1"># 或者直接调用</span>
<span class="nb">print</span><span class="p">(</span><span class="n">module</span><span class="o">.</span><span class="n">a</span><span class="p">)</span> <span class="c1"># -&gt; 2, reload 之后就变了</span>

<span class="c1">#[] cell 0</span>
<span class="c1"># a = 3</span>
<span class="c1">#[] cell 1</span>
<span class="nb">print</span><span class="p">(</span><span class="n">module</span><span class="o">.</span><span class="n">a</span><span class="p">)</span> <span class="c1"># -&gt; 3, 新启动 cell 会进行 auto reload</span>

<span class="c1"># 另外重新记录的话，会立刻改变</span>
<span class="k">with</span> <span class="n">session</span><span class="o">.</span><span class="n">modules_globals</span><span class="p">():</span>
    <span class="n">a</span> <span class="o">=</span> <span class="mi">3</span>      <span class="c1"># module.a -&gt; 3</span>
</pre></div>
</div>
</dd>
</dl>
</li>
</ol>
<p>Examples:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># main.ipynb</span>
<span class="c1"># 构造 session 来运行</span>
<span class="kn">import</span> <span class="nn">demo</span> <span class="k">as</span> <span class="nn">demo2</span>
<span class="n">demo2</span><span class="o">.</span><span class="n">foo</span> <span class="o">=</span> <span class="mi">123</span>
<span class="n">session</span> <span class="o">=</span> <span class="n">GlobalSession</span><span class="p">(</span><span class="nb">globals</span><span class="p">(),</span> <span class="p">(</span><span class="n">demo2</span><span class="p">,</span> <span class="p">),</span> <span class="n">session_config</span><span class="o">=</span><span class="n">SessionConfig</span><span class="p">())</span>
<span class="k">with</span> <span class="n">session</span><span class="o">.</span><span class="n">modules_globals</span><span class="p">():</span>
    <span class="n">foo</span> <span class="o">=</span> <span class="mi">1</span>  <span class="c1"># 如果 demo2 中定义了 doo，会更新demo2 中的 foo 为 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.package">
<span class="sig-name descname"><span class="pre">package</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">blocking</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">star</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.package"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.package" title="Permalink to this definition">¶</a></dt>
<dd><p>将多进程任务打包成一个任务运行，主要适用于我们想要提交远程任务的时候，方便在一个机器上启动一个多进程任务，而不是启动一堆任务</p>
<p>实现上调用的是 pool.map/pool.starmap，所以使用 iterable 作为接口名字，不是 inline 模式</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">session</span><span class="o">.</span><span class="n">package</span><span class="p">(</span><span class="n">demo</span><span class="o">.</span><span class="n">func</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">star</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>

<span class="c1"># 等同于</span>
<span class="c1"># demo_p.py</span>
<span class="k">def</span> <span class="nf">package_func</span><span class="p">():</span>
    <span class="n">pool</span> <span class="o">=</span> <span class="n">multiprocessing</span><span class="o">.</span><span class="n">Pool</span><span class="p">(</span><span class="n">process_limit</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">pool</span><span class="o">.</span><span class="n">map</span><span class="p">(</span><span class="n">demo</span><span class="o">.</span><span class="n">func</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)])</span>
    <span class="c1"># return pool.starmap(demo.func, [(0, 1), (2, 3)])  若 star = True</span>
<span class="n">session</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">demo_p</span><span class="o">.</span><span class="n">package_func</span><span class="p">(),</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="n">local</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> – 需要引用的函数</p></li>
<li><p><strong>iterable</strong> – [(1, 2), (3, 4)] -&gt; star = True: func(1, 2), func(3, 4) else func((1, 2)), func((3, 4))</p></li>
<li><p><strong>local</strong> – 本地运行</p></li>
<li><p><strong>group</strong> – 远程运行到哪个分组的机器上</p></li>
<li><p><strong>blocking</strong> – 是否放后台运行</p></li>
<li><p><strong>stdout</strong> – 要不要 stdout 输出内容，默认 False 防止进程太多打爆；outline 会把 stdout pkl 下来方便日后查看</p></li>
<li><p><strong>star</strong> – 是否使用 starmap 来处理，默认使用 map</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>blocking True 返回对应的输出；False 返回List[AsyncResult]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.package_async">
<span class="sig-name descname"><span class="pre">package_async</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.package_async"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.package_async" title="Permalink to this definition">¶</a></dt>
<dd><p>starpackage, 类比 pool.starmap</p>
<p>iterable: [(1, 2), (3, 4)] -&gt; func(1, 2), func(3, 4)</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.save_global_vars">
<span class="sig-name descname"><span class="pre">save_global_vars</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.save_global_vars"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.save_global_vars" title="Permalink to this definition">¶</a></dt>
<dd><p>手动触发保存 global var，这样不用每次调用的时候都存一遍了
:return:</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.set_process_limit">
<span class="sig-name descname"><span class="pre">set_process_limit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">process_limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.set_process_limit"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.set_process_limit" title="Permalink to this definition">¶</a></dt>
<dd><p>动态调整，限制运行时候的 process pool 进程数量，注意，已经启动的 process 不会被关闭</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>process_limit</strong> – 0，表示不限制，将使用 cpu 的 process 数量</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.starmap">
<span class="sig-name descname"><span class="pre">starmap</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">blocking</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.starmap"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.starmap" title="Permalink to this definition">¶</a></dt>
<dd><p>iterable: [(1, 2), (3, 4)] -&gt; start = True: func(1, 2), func(3, 4)</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List[Async_result]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.starmap_async">
<span class="sig-name descname"><span class="pre">starmap_async</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.starmap_async"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.starmap_async" title="Permalink to this definition">¶</a></dt>
<dd><p>iterable: [(1, 2), (3, 4)] -&gt; start = True: func(1, 2), func(3, 4)</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List[Async_result]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.starpackage">
<span class="sig-name descname"><span class="pre">starpackage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.starpackage"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.starpackage" title="Permalink to this definition">¶</a></dt>
<dd><p>starpackage 的异步调用，返回 async result</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> – </p></li>
<li><p><strong>iterable</strong> – </p></li>
<li><p><strong>local</strong> – </p></li>
<li><p><strong>group</strong> – </p></li>
<li><p><strong>stdout</strong> – </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="hfai.client.remote.GlobalSession.starpackage_async">
<span class="sig-name descname"><span class="pre">starpackage_async</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stdout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#GlobalSession.starpackage_async"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.GlobalSession.starpackage_async" title="Permalink to this definition">¶</a></dt>
<dd><p>package 的异步调用，返回 async result</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> – </p></li>
<li><p><strong>iterable</strong> – </p></li>
<li><p><strong>local</strong> – </p></li>
<li><p><strong>group</strong> – </p></li>
<li><p><strong>stdout</strong> – </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="hfai.client.remote.SessionConfig">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">hfai.client.remote.</span></span><span class="sig-name descname"><span class="pre">SessionConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">local</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">group</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'jd_dev_alpha'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nb_auto_reload</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">process_limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">priority</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">50</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">image</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/hfai/client/remote/session.html#SessionConfig"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hfai.client.remote.SessionConfig" title="Permalink to this definition">¶</a></dt>
<dd><p>配置Session，本地还是远程，远程用哪个分组</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>local</strong> – 本地运行, 默认 True</p></li>
<li><p><strong>inline</strong> – 在本地运行时候，不使用 python module.py 的模式，默认 True</p></li>
<li><p><strong>group</strong> – 远程运行时候提交的分组, 默认 jd_dev_alpha</p></li>
<li><p><strong>nb_auto_reload</strong> – 在运行 cell 之前自动 reload module</p></li>
<li><p><strong>process_limit</strong> – 后台运行的子进程数量, 0 表示和 cpu_count 一样</p></li>
<li><p><strong>priority</strong> – 以什么优先级来提交任务，不设置则用最高优先级运行</p></li>
<li><p><strong>image</strong> – 使用什么镜像运行，不填则用用户默认的镜像</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>


              </article>
              
            </div>
            <footer>
  
  <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
    
    <a href="../misc/env_var.html" class="btn btn-neutral float-right" title="环境变量" accesskey="n"
      rel="next">Next <img src="../_static/images/chevron-right-blue.svg"
        class="next-page"></a>
    
    
    <a href="client.html" class="btn btn-neutral" title="hfai.client" accesskey="p"
      rel="prev"><img src="../_static/images/chevron-right-blue.svg" class="previous-page"> Previous</a>
    
  </div>
  

  <hr>

  <div role="contentinfo">
    <p>
      &copy; Copyright 2023, High-Flyer.

    </p>
  </div>
  
  <div>
    Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a
      href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the
      Docs</a>.
  </div>
   

</footer>
          </div>
        </div>

        <div class="pytorch-content-right" id="pytorch-content-right">
          <div class="pytorch-right-menu" id="pytorch-right-menu">
            <div class="pytorch-side-scroll" id="pytorch-side-scroll-right">
              <ul>
<li><a class="reference internal" href="#">hfai.client.remote</a></li>
</ul>

            </div>
          </div>
        </div>
    </section>
  </div>

  


  

  
  <script type="text/javascript" id="documentation_options" data-url_root="../"
    src="../_static/documentation_options.js"></script>
  <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  <script src="../_static/jquery.js"></script>
  <script src="../_static/underscore.js"></script>
  <script src="../_static/doctools.js"></script>
  <script src="../_static/js/vue.global.prod.js"></script>
  <script src="../_static/js/element-plus.full.js"></script>
  

  

  <script type="text/javascript" src="../_static/js/vendor/popper.min.js"></script>
  <script type="text/javascript" src="../_static/js/vendor/bootstrap.min.js"></script>
  <script src="../_static/external/list.min.js"></script>
  <script type="text/javascript" src="../_static/js/theme.js"></script>

  <script type="text/javascript">
    jQuery(function () {
      SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

  <!-- Begin Footer -->

  <!-- <div class="container-fluid docs-tutorials-resources" id="docs-tutorials-resources">
  </div> -->

  <!-- End Footer -->

  <!-- Begin Mobile Menu -->

  <div class="mobile-main-menu">
    <div class="container-fluid">
      <div class="container">
        <div class="mobile-main-menu-header-container">
          <a class="header-logo" href="" aria-label="OpenMMLab"></a>
          <a class="main-menu-close-button" href="#" data-behavior="close-mobile-menu"></a>
        </div>
      </div>
    </div>

    <div class="mobile-main-menu-links-container">
      <div class="main-menu">
        <ul>
      </div>
    </div>
  </div>

  <!-- End Mobile Menu -->

  <script type="text/javascript" src="../_static/js/vendor/anchor.min.js"></script>

  <script type="text/javascript">
    $(document).ready(function () {
      mobileMenu.bind();
      mobileTOC.bind();
      pytorchAnchors.bind();
      sideMenus.bind();
      scrollToAnchor.bind();
      highlightNavigation.bind();
      mainMenuDropdown.bind();
      filterTags.bind();

      // Add class to links that have code blocks, since we cannot create links in code blocks
      $("article.pytorch-article a span.pre").each(function (e) {
        $(this).closest("a").addClass("has-code");
      });
    })
  </script>
</body>

</html>